package com.boarsoft.boar.demo.order;

import java.io.IOException;
import java.util.Properties;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.boarsoft.common.Util;

public class Config {
	private final static Logger log = LoggerFactory.getLogger(Config.class);
	private final static Properties prop = new Properties();

	static {
		try {
			log.info("Load demo-order-app config.properties ...");
			prop.load(Config.class.getClassLoader().getResourceAsStream("config.properties"));
		} catch (IOException e) {
			log.error("Error on load config.properties.", e);
		}
	}

	public static final int HTTP_PORT = getInt("http.port", 8080);

	public static int getInt(String key, int value) {
		return Util.str2int(prop.getProperty(key), value);
	}
}